const path = require('path');

const filepath=path.join(__dirname, 'public');

module.exports = {
  entry: filepath+'/src/index.js',
  output: {
    filename: 'bundle.js',
    path: path.resolve(filepath, 'dist')
  },
  module: {
     rules: [
       {
         test: /\.css$/,
         use: ['style-loader','css-loader']
       },
        {
         test: /\.(png|svg|jpg|gif)$/,
         use: [
           {
             loader:'file-loader',
             options:{
                name: '[hash].[ext]',
                publicPath: 'dist/',//自定义的输出路径
                outputPath: 'images/',//发布目录
             }
            }
          ]
       },
       {
         test: /\.(woff|woff2|eot|ttf|otf)$/,
         use: [
           {
             loader:'file-loader',
             options:{
                name: '[hash].[ext]',
                publicPath: 'dist/',//自定义的输出路径
                outputPath: 'font-icons/',//发布目录
             }
            }
         ]
       }
     ]
   }
};